package com.kly.chatter.api.application.controller.chatter.res;

import com.kly.user.dto.InterestDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@ApiModel(description = "interest 返回参数")
public class InterestsRes implements Serializable {

    @ApiModelProperty(value = "编号")
    private long id;

    @ApiModelProperty(value = "名称")
    private String interest;

    public static List<InterestsRes> toInterestsRes(List<InterestDto> interestDtos) {
        List<InterestsRes> interestsResList = new ArrayList<>();
        interestDtos.forEach(interest -> {
            InterestsRes interestsRes = new InterestsRes();
            interestsRes.setId(interest.getId());
            interestsRes.setInterest(interest.getInterestName());
            interestsResList.add(interestsRes);
        });
        return interestsResList;
    }
}
